﻿using System.Drawing;
using System.IO;
using Bluebird.Printer;

namespace Dfass.Retail.Printing
{
    public class PrinterUtils : BasePrinterUtils {
        
        public PrinterUtils() {
            // EN : Apply currently selected changes
            SetPrintOption();
        }

        public void SetLineSpacing(uint spacing) {
            Prntr.SetLineSpacing(spacing);
        }

        #region print
        public void PrintText(string content, uint alignment) {
            Prntr.PrintText(content, alignment);
        }

        public void PrintBitmap(string fileFullname) {
            // EN : Align center
            Prntr.PrintBitmap(fileFullname, Printer.BITMAP_ALIGN_CENTER);
        }
       
        private void SetPrintOption()
        {
            // KR : 진하기 설정 값을 적용
            // EN : Apply light/dark configuration value
            uint nDensity = Printer.DENSITY_MIN;
            ;
            // KR : Font Type을 적용할 FontSet 값 적용
            // EN : Apply FontSet value to adjust Font Type
            uint nFontSet = Printer.FONTSET_ASCII;
            // KR : Font Type을 적용할 FontSet 값 적용
            // EN : Apply FontSet value to adjust Font Type
            uint nFontType = Printer.FONTTYPE_42;

            // KR : UI에서 읽어온 값을 실제로 Printer에 대입한다.
            // EN : Substitute reading value from UI to real Printer
            Prntr.SetDensity(nDensity);
            Prntr.RegisterFontFromSet(nFontSet, nFontType);

            Prntr.SetLineSpacing(1);
        }
        #endregion
    }
}
